package com.gitee.funcy.disruptorlearn.ch03.sigle;

import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.WorkHandler;

/**
 * @author fangchengyan
 * @date 2019-03-15 18:17
 */
public class Handler1 implements EventHandler<Trade>, WorkHandler<Trade> {

    @Override
    public void onEvent(Trade trade, long l, boolean b) throws Exception {
        this.onEvent(trade);
    }

    @Override
    public void onEvent(Trade trade) throws Exception {
        System.out.println("handler 1 : set name");
        Thread.sleep(1000);
        trade.setName("h1");
    }
}
